#ifndef _SM2_TEST_H_
#define _SM2_TEST_H_

struct akcipher_testvec {
	unsigned char *pub_key;
	unsigned char *priv_key;
	unsigned char *key;
	unsigned char *params;
	unsigned char *m;
	unsigned char *c;
	unsigned int key_len;
	unsigned int param_len;
	unsigned int m_size;
	unsigned int c_size;
	bool public_key_vec;
	bool siggen_sigver_test;
	enum OID algo;
};

/*
 * SM2 test vectors.
 */
static const struct akcipher_testvec sm2_tv_template[] = {
	{
		/* Generated from openssl */
		.key = "\x04"
		       "\x8e\xa0\x33\x69\x91\x7e\x3d\xec\xad\x8e\xf0\x45\x5e\x13\x3e\x68"
		       "\x5b\x8c\xab\x5c\xc6\xc8\x50\xdf\x91\x00\xe0\x24\x73\x4d\x31\xf2"
		       "\x2e\xc0\xd5\x6b\xee\xda\x98\x93\xec\xd8\x36\xaa\xb9\xcf\x63\x82"
		       "\xef\xa7\x1a\x03\xed\x16\xba\x74\xb8\x8b\xf9\xe5\x70\x39\xa4\x70",
		.key_len = 65,
		.param_len = 0,
		.c = "\x30\x45"
		     "\x02\x20"
		     "\x70\xab\xb6\x7d\xd6\x54\x80\x64\x42\x7e\x2d\x05\x08\x36\xc9\x96"
		     "\x25\xc2\xbb\xff\x08\xe5\x43\x15\x5e\xf3\x06\xd9\x2b\x2f\x0a\x9f"
		     "\x02\x21"
		     "\x00"
		     "\xbf\x21\x5f\x7e\x5d\x3f\x1a\x4d\x8f\x84\xc2\xe9\xa6\x4c\xa4\x18"
		     "\xb2\xb8\x46\xf4\x32\x96\xfa\x57\xc6\x29\xd4\x89\xae\xcc\xda\xdb",
		.c_size = 71,
		.algo = OID_SM2_with_SM3,
		.m = "\x47\xa7\xbf\xd3\xda\xc4\x79\xee\xda\x8b\x4f\xe8\x40\x94\xd4\x32"
		     "\x8f\xf1\xcd\x68\x4d\xbd\x9b\x1d\xe0\xd8\x9a\x5d\xad\x85\x47\x5c",
		.m_size = 32,
		.public_key_vec = true,
		.siggen_sigver_test = true,
	},
	{
		/* From libgcrypt */
		.key = "\x04"
		       "\x87\x59\x38\x9a\x34\xaa\xad\x07\xec\xf4\xe0\xc8\xc2\x65\x0a\x44"
		       "\x59\xc8\xd9\x26\xee\x23\x78\x32\x4e\x02\x61\xc5\x25\x38\xcb\x47"
		       "\x75\x28\x10\x6b\x1e\x0b\x7c\x8d\xd5\xff\x29\xa9\xc8\x6a\x89\x06"
		       "\x56\x56\xeb\x33\x15\x4b\xc0\x55\x60\x91\xef\x8a\xc9\xd1\x7d\x78",
		.key_len = 65,
		.param_len = 0,
		.c = "\x30\x44"
		     "\x02\x20"
		     "\xd9\xec\xef\xe8\x5f\xee\x3c\x59\x57\x8e\x5b\xab\xb3\x02\xe1\x42"
		     "\x4b\x67\x2c\x0b\x26\xb6\x51\x2c\x3e\xfc\xc6\x49\xec\xfe\x89\xe5"
		     "\x02\x20"
		     "\x43\x45\xd0\xa5\xff\xe5\x13\x27\x26\xd0\xec\x37\xad\x24\x1e\x9a"
		     "\x71\x9a\xa4\x89\xb0\x7e\x0f\xc4\xbb\x2d\x50\xd0\xe5\x7f\x7a\x68",
		.c_size = 70,
		.algo = OID_SM2_with_SM3,
		.m = "\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff\x00"
		     "\x12\x34\x56\x78\x9a\xbc\xde\xf0\x12\x34\x56\x78\x9a\xbc\xde\xf0",
		.m_size = 32,
		.public_key_vec = true,
		.siggen_sigver_test = true,
	},
	{
		/* From gmssl */
		.m_size = 112,
		.c_size = 220,
		.key_len = 32,
		.pub_key =
			"\x04\xd7\x4e\xd1\x3e\x2d\xc9\x91\x14\x73\x16\x38\x5b\x67\x4b\xd5\x60"
			"\x01\xa6\x0f\x03\x9b\xfc\x01\x88\x6a\xeb\x52\xa3\x43\x0c\xdc\xbc"
			"\xbc\x01\xa4\x1e\x32\xce\x92\xb9\x4e\x50\x44\x2e\xb1\x5c\xd4\x24"
			"\xc1\x23\x7e\xc4\x2e\x44\x2c\x90\x95\x6a\x26\x46\x43\x93\x12\x26",
		.priv_key =
			"\x83\xdc\xa0\xad\xa3\xd7\x7e\xa4\xed\x20\x89\x56\x1d\xc3\x96\x37"
			"\x5e\xa9\xce\x50\x63\x29\xe4\x9c\x0d\xe4\x99\x49\x0a\xcd\x03\x78",
		.key = "\x83\xdc\xa0\xad\xa3\xd7\x7e\xa4\xed\x20\x89\x56\x1d\xc3\x96\x37"
		       "\x5e\xa9\xce\x50\x63\x29\xe4\x9c\x0d\xe4\x99\x49\x0a\xcd\x03\x78",
		.c = "\x30\x81\xd9\x02\x20\x0c\xa3\x62\x62\xe4\xcf\xda\x5b\xfc\x6d\x90"
		     "\xe2\xc7\xa9\x49\x5b\x80\xcf\x20\xef\x9b\x4f\xff\xef\xa0\xae\x40"
		     "\xbf\xe4\x68\x84\x8c\x02\x21\x00\x87\xc6\x20\xf0\x2f\xb9\xf0\x22"
		     "\x17\x6b\x27\x50\x7d\xcd\x8c\x8d\x9b\xa6\xf3\x4d\xb1\xc9\x4a\x3a"
		     "\xe0\x94\x41\xb2\x4c\x24\x00\x98\x04\x20\x4b\xc9\x6b\xe0\xf9\xdf"
		     "\xc7\xe5\x57\xe9\x6b\x0d\xa2\xd7\x75\xf9\x14\x8e\xef\xdb\x1b\xcd"
		     "\xf8\x18\xb0\x71\x7f\x3b\x92\xf3\xf9\xf3\x04\x70\x86\x7e\x7c\x9f"
		     "\xff\xa2\x1b\xfa\xc1\xac\xbb\x0a\x5c\xe6\xc0\x51\x4a\x37\x33\x76"
		     "\x4d\x51\x40\xfc\xb8\x20\x9d\x4f\xe3\x12\xe5\xfe\xa1\xc3\x59\x4c"
		     "\xd4\x1f\xae\x92\xaa\x44\x26\x76\x17\x67\xce\xb0\x2e\x88\x17\x6c"
		     "\x4c\xb5\x4f\x0d\x94\x96\x97\x5a\x8b\x17\x33\x36\x26\x06\x17\xd4"
		     "\x4a\x36\x29\x3c\x46\x52\x54\x95\xbf\x9f\xe2\x55\xfc\x9e\x39\x65"
		     "\xd8\x64\xe3\x8f\xe2\x97\xa7\xb8\x5b\xd4\xc3\x63\xdf\xdd\x01\x32"
		     "\x9e\x07\xa3\xd2\xe5\xc4\x97\xbb\xb0\x95\x27\xa3",
		.algo = OID_SM2_with_SM3,
		.m = "\x42\x47\x30\x77\x61\x77\x49\x42\x41\x51\x51\x67\x67\x39\x79\x67"
		     "\x72\x61\x50\x58\x66\x71\x54\x74\x49\x49\x6c\x57\x0a\x48\x63\x4f"
		     "\x57\x4e\x31\x36\x70\x7a\x6c\x42\x6a\x4b\x65\x53\x63\x44\x65\x53"
		     "\x5a\x53\x51\x72\x4e\x41\x33\x69\x68\x52\x41\x4e\x43\x41\x41\x54"
		     "\x58\x54\x74\x45\x2b\x4c\x63\x6d\x52\x46\x48\x4d\x57\x4f\x46\x74"
		     "\x6e\x53\x39\x56\x67\x41\x61\x59\x50\x41\x35\x76\x38\x0a\x41\x59"
		     "\x68\x71\x36\x31\x4b\x6a\x51\x77\x7a\x63\x76\x4c\x77\x42\x70\x42",
		.public_key_vec = false,
		.siggen_sigver_test = false,
	},
	{
		.pub_key =
			"\x04\xd7\x4e\xd1\x3e\x2d\xc9\x91\x14\x73\x16\x38\x5b\x67\x4b\xd5\x60"
			"\x01\xa6\x0f\x03\x9b\xfc\x01\x88\x6a\xeb\x52\xa3\x43\x0c\xdc\xbc"
			"\xbc\x01\xa4\x1e\x32\xce\x92\xb9\x4e\x50\x44\x2e\xb1\x5c\xd4\x24"
			"\xc1\x23\x7e\xc4\x2e\x44\x2c\x90\x95\x6a\x26\x46\x43\x93\x12\x26",
		.priv_key =
			"\x83\xdc\xa0\xad\xa3\xd7\x7e\xa4\xed\x20\x89\x56\x1d\xc3\x96\x37"
			"\x5e\xa9\xce\x50\x63\x29\xe4\x9c\x0d\xe4\x99\x49\x0a\xcd\x03\x78",
		.key = "\x04\xd7\x4e\xd1\x3e\x2d\xc9\x91\x14\x73\x16\x38\x5b\x67\x4b\xd5\x60"
		       "\x01\xa6\x0f\x03\x9b\xfc\x01\x88\x6a\xeb\x52\xa3\x43\x0c\xdc\xbc"
		       "\xbc\x01\xa4\x1e\x32\xce\x92\xb9\x4e\x50\x44\x2e\xb1\x5c\xd4\x24"
		       "\xc1\x23\x7e\xc4\x2e\x44\x2c\x90\x95\x6a\x26\x46\x43\x93\x12\x26",
		.key_len = 65,
		.params =
			"\x30\x13\x06\x07\x2a\x86\x48\xce\x3d\x02\x01\x06\x08\x2a\x86\x48"
			"\xce\x3d\x03\x01\x01",
		.param_len = 21,
		.algo = OID_SM2_with_SM3,
		.m = "\x30\x81\xd9\x02\x20\x0c\xa3\x62\x62\xe4\xcf\xda\x5b\xfc\x6d\x90"
		     "\xe2\xc7\xa9\x49\x5b\x80\xcf\x20\xef\x9b\x4f\xff\xef\xa0\xae\x40"
		     "\xbf\xe4\x68\x84\x8c\x02\x21\x00\x87\xc6\x20\xf0\x2f\xb9\xf0\x22"
		     "\x17\x6b\x27\x50\x7d\xcd\x8c\x8d\x9b\xa6\xf3\x4d\xb1\xc9\x4a\x3a"
		     "\xe0\x94\x41\xb2\x4c\x24\x00\x98\x04\x20\x4b\xc9\x6b\xe0\xf9\xdf"
		     "\xc7\xe5\x57\xe9\x6b\x0d\xa2\xd7\x75\xf9\x14\x8e\xef\xdb\x1b\xcd"
		     "\xf8\x18\xb0\x71\x7f\x3b\x92\xf3\xf9\xf3\x04\x70\x86\x7e\x7c\x9f"
		     "\xff\xa2\x1b\xfa\xc1\xac\xbb\x0a\x5c\xe6\xc0\x51\x4a\x37\x33\x76"
		     "\x4d\x51\x40\xfc\xb8\x20\x9d\x4f\xe3\x12\xe5\xfe\xa1\xc3\x59\x4c"
		     "\xd4\x1f\xae\x92\xaa\x44\x26\x76\x17\x67\xce\xb0\x2e\x88\x17\x6c"
		     "\x4c\xb5\x4f\x0d\x94\x96\x97\x5a\x8b\x17\x33\x36\x26\x06\x17\xd4"
		     "\x4a\x36\x29\x3c\x46\x52\x54\x95\xbf\x9f\xe2\x55\xfc\x9e\x39\x65"
		     "\xd8\x64\xe3\x8f\xe2\x97\xa7\xb8\x5b\xd4\xc3\x63\xdf\xdd\x01\x32"
		     "\x9e\x07\xa3\xd2\xe5\xc4\x97\xbb\xb0\x95\x27\xa3",
		.m_size = 220,
		.public_key_vec = true,
		.siggen_sigver_test = false,
	},
	{
		.pub_key =
			"\x04\xd7\x4e\xd1\x3e\x2d\xc9\x91\x14\x73\x16\x38\x5b\x67\x4b\xd5\x60"
			"\x01\xa6\x0f\x03\x9b\xfc\x01\x88\x6a\xeb\x52\xa3\x43\x0c\xdc\xbc"
			"\xbc\x01\xa4\x1e\x32\xce\x92\xb9\x4e\x50\x44\x2e\xb1\x5c\xd4\x24"
			"\xc1\x23\x7e\xc4\x2e\x44\x2c\x90\x95\x6a\x26\x46\x43\x93\x12\x26",
		.priv_key =
			"\x83\xdc\xa0\xad\xa3\xd7\x7e\xa4\xed\x20\x89\x56\x1d\xc3\x96\x37"
			"\x5e\xa9\xce\x50\x63\x29\xe4\x9c\x0d\xe4\x99\x49\x0a\xcd\x03\x78",
		.key = "\x83\xdc\xa0\xad\xa3\xd7\x7e\xa4\xed\x20\x89\x56\x1d\xc3\x96\x37"
		       "\x5e\xa9\xce\x50\x63\x29\xe4\x9c\x0d\xe4\x99\x49\x0a\xcd\x03\x78",
		.key_len = 32,
		.params =
			"\x30\x13\x06\x07\x2a\x86\x48\xce\x3d\x02\x01\x06\x08\x2a\x86\x48"
			"\xce\x3d\x03\x01\x01",
		.param_len = 21,
		.algo = OID_SM2_with_SM3,
		.m = "\x30\x81\xd9\x02\x20\x0c\xa3\x62\x62\xe4\xcf\xda\x5b\xfc\x6d\x90"
		     "\xe2\xc7\xa9\x49\x5b\x80\xcf\x20\xef\x9b\x4f\xff\xef\xa0\xae\x40",
		.m_size = 32,
		.public_key_vec =
			false, // key类型， public只执行验签， private 只执行签名
		.siggen_sigver_test = true,
	},

};

#endif